package com.ruoyi.project.comp.h5;

import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.comp.comment.domain.CompComment;
import com.ruoyi.project.comp.comment.service.ICompCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 作品评论Controller
 * 
 * @author ruoyi
 * @date 2025-11-02
 */
@Controller
@RequestMapping("/h5/comp/comment")
public class H5CompCommentController extends BaseController
{
    private String prefix = "h5/comp/comment";

    @Autowired
    private ICompCommentService compCommentService;

    @GetMapping()
    public String comment()
    {
        return prefix + "/comment";
    }

    /**
     * 导出作品评论列表
     */
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(CompComment compComment)
    {
        List<CompComment> list = compCommentService.selectCompCommentList(compComment);
        ExcelUtil<CompComment> util = new ExcelUtil<CompComment>(CompComment.class);
        return util.exportExcel(list, "作品评论数据");
    }

    /**
     * 新增作品评论
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存作品评论
     */
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(CompComment compComment)
    {
        return toAjax(compCommentService.insertCompComment(compComment));
    }






}
